package com.future.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.future.domain.ChatRoomMember;
import com.future.domain.DTO.MembersDTO;
import com.future.domain.DTO.PeopleDTO;
import com.future.domain.Role;
import com.future.domain.User;
import org.apache.ibatis.annotations.*;
import org.springframework.security.core.parameters.P;

import java.util.List;

@Mapper
public interface
ChatRoomMemberMapper extends BaseMapper<ChatRoomMember> {
    int countMembersByRoomId(@Param("chatRoomId") Long chatRoomId);

    List<User> selectUsersByRoomId(@Param("roomId")Long roomId);
    List<Long> selectUserIdByRoomId(@Param("roomId")Long roomId);

    List<Long>selectUserIdByClassId(@Param("classId")Long classId);
    /**
     * 2. 批量插入聊天室成员
     */
    void batchInsert(@Param("roomId") Long roomId, @Param("list") List<Long> userIdList);
    void InsertMember(@Param("roomId") Long roomId, @Param("userId") Long userId);
    List<ChatRoomMember> selectMembersByRoomId(Long chatRoomId);
    List<MembersDTO> selectRoomMemberDTOs(Long roomId);
    int batchUpdateIsOnline(@Param("list") List<ChatRoomMember> members);
    MembersDTO selectMemberDTO(@Param("userId")Long userId,
                               @Param("roomId")Long roomId);
    Integer selectisOnlinebyuserId(Long userId);
    List<PeopleDTO> selectUserByuserName(String userName);
    List<Long>selectUserIdByclassName(String className);

   List<User> selectUsersNeverJoined();
   void savaClassMember(@Param("userIds")List<Long> userIds,
                        @Param("classId")Long classId);
   List<String> selectRoleNamesByUserId(Long userId);
}
